package com.codedancer.campus.enums;

import cn.hutool.core.util.ObjectUtil;
import com.codedancer.campus.common.enums.CodeDbEnum;
import com.fasterxml.jackson.annotation.JsonValue;

/**
 * 评论举报状态
 */
public enum CommentReportStatus implements CodeDbEnum {

  PENDING_REVIEW(1, "待审核"),
  EXISTS_VIOLATION(2, "存在违规"),
  NOE_EXISTS_VIOLATION(3, "不存在违规");

  /**
   * 对应的值
   */
  @JsonValue
  private final Integer value;

  /**
   * 对应的名称
   */
  private final String name;

  CommentReportStatus(Integer value, String name) {
    this.value = value;
    this.name = name;
  }

  public static CommentReportStatus fromValue(Integer value) {
    for (CommentReportStatus commentReportStatus : CommentReportStatus.values()) {
      if (ObjectUtil.equal(commentReportStatus.getValue(), value)) {
        return commentReportStatus;
      }
    }
    return null;
  }

  @Override
  public Integer getValue() {
    return value;
  }

  public String getName() {
    return name;
  }

}
